package com.jyu.edu.dto;

import com.jyu.edu.entity.User;
import com.jyu.edu.entityEnum.UserStatusTypeEnum;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class UserDto{
	
	long id;
	String username;
	String headImg;
	Integer status;
	String statusName;
	RoleDto role;
	public UserDto convert(User user) {
		setUsername(user.getUsername());
		setId(user.getId());
		setHeadImg(user.getHeadImg());
		setStatus(user.getStatus());
		setStatusName(UserStatusTypeEnum.values()[user.getStatus()].getName());
		setRole(new RoleDto().convert(user.getRole()));
		return this;
	}
	
}
